﻿Imports System.ComponentModel

Public Class WatchEnemy

    Public type As Integer

    Public bone As New Bone

    Enum EnemyType
        Add
        Upd
    End Enum


    Private Sub WatchEnemy_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        If Me.type = WatchEnemy.EnemyType.Add Then
            Me.Text = "新規"
        Else
            Me.Text = "更新"
        End If

    End Sub

    Private Sub btnConfirm_Click(sender As Object, e As EventArgs) Handles btnConfirm.Click

        If Me.cbCreate.Checked = False And Me.cbRename.Checked = False And cbDelete.Checked = False And cbChange.Checked = False Then
            MessageBox.Show("Need choose a monitoring event!!")
            Return
        End If

        If "".Equals(Me.txtFileName.Text) Then
            MessageBox.Show("Need input a monitoring file name!!!")
            Return
        End If

        bone = New Bone()
        bone.FileName = Me.txtFileName.Text
        bone.NeedMonitorCreate = Me.cbCreate.CheckState
        bone.CreateMessage = Me.txtCreateMessage.Text
        bone.NeedMonitorRename = Me.cbRename.CheckState
        bone.RenameMessage = Me.txtRenameMessage.Text
        bone.NeedMonitorDelete = Me.cbDelete.CheckState
        bone.DeleteMessage = Me.txtDeleteMessage.Text
        bone.NeedMonitorChange = Me.cbChange.CheckState
        bone.ChangeMessage = Me.txtChangeMessage.Text
        Me.Close()

    End Sub

    Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
        Me.Close()
    End Sub

    Private Sub checkbox_CheckedChanged(sender As Object, e As EventArgs) Handles cbCreate.CheckedChanged, cbRename.CheckedChanged, cbDelete.CheckedChanged, cbChange.CheckedChanged
        Select Case sender.name
            Case cbCreate.Name
                txtCreateMessage.Enabled = cbCreate.Checked
            Case cbRename.Name
                txtRenameMessage.Enabled = cbRename.Checked
            Case cbDelete.Name
                txtDeleteMessage.Enabled = cbDelete.Checked
            Case cbChange.Name
                txtChangeMessage.Enabled = cbChange.Checked
        End Select
    End Sub
End Class